<template>
    <a-card :bordered="false">
        <div class="table-operator">
            <a-button shape="round" size="small" type="primary" icon="plus" @click="handleEdit({},'systemForm','新增')">添加</a-button>
            <!-- <a-button shape="round" size="small" type="primary" icon="plus" @click="test">测试</a-button> -->
        </div>

        <LTable
        ref="systemList"
        size="middle"
        rowKey="keyId"
        :formAttributes="formAttributes"
        :columns="columns"
        axiosUrl="/SysSystemController/page"
        :showPagination="true"
        :showQueryForm="true"
      >
         <span slot="systemUse" slot-scope="text,record">
            <a-icon v-if="record.systemUse==1" type="check" :style="{ color: 'green' }"/>
            <a-icon v-else type="close" :style="{ color: 'hotpink',fontSize: '14px'}"/>
        </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleEdit(record,'systemForm',record.systemName)">编辑</a>
          <!-- <a-divider type="vertical" />
          <a-popconfirm title="此系统所有数据将被删除，确定删除吗?" @confirm="() => handleDelete({systemNo:record.systemNo},'/SysSystemController/del','systemList')">
                <a>删除</a>
            </a-popconfirm> -->
        </span>
        
    </LTable>
    <systemForm ref="systemForm" @close="refresh('systemList')" @ok="refresh('systemList')"></systemForm> 
    <router-view/>
    </a-card>
</template>

<script>
import LTable from '@/components/lt/LTable'
import systemForm from './systemForm'
import {SysMixin} from '@/mixins/SysMixin'


export default {
    name:'roleList',
    components:{
       LTable,systemForm
    },
    mixins:[SysMixin],
    data(){
        return{
            formAttributes:[
                {field:'systemName',label:'系统名称',component:'input',condition:'like'},
            ],
         
            columns:[
                {
                    title: '序号',
                    dataIndex: '',
                    key:'rowIndex',
                    width:60,
                    align:"center",
                    customRender:function (t,r,index) {
                      return parseInt(index)+1;
                    }
                },
                
                {
                    title: '系统编号',
                    dataIndex: 'systemNo'
                },
                {
                    title: '系统名称',
                    dataIndex: 'systemName'
                    
                },
                {
                    title: '系统地址',
                    dataIndex: 'systemUrl'
                },
                {
                    title: '是否可用',
                    dataIndex: 'systemUse',
                    scopedSlots: { customRender: 'systemUse' }
                },
                {
                    title: '操作',
                    dataIndex: 'action',
                    width: '120px',
                    scopedSlots: { customRender: 'action' }
                }
            ],
            
        }
    },
    methods:{
        test(){
            // this.$router.push({ path:"/exception/404" })
        }
        
    }
}
</script>